package com.yunda.nebula.gateway.sync.nacos;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Objects;
import java.util.Properties;

import static com.alibaba.nacos.api.PropertyKeyConst.NAMESPACE;
import static com.alibaba.nacos.api.PropertyKeyConst.SERVER_ADDR;

/**
 * \* User: wei.zhang
 * \* Date: 2020/9/18 13:23
 * \* Description:
 *
 * @author wei.zhang
 * \
 */
@Data
public class NacosConfig {
    public static final String PREFIX = "nebula.gateway.sync.nacos.config";

    private String serverAddress;

    private String namespace;

    private Long timeout = 100000L;

    private String group = "DEFAULT_GROUP";


    @Value("${spring.application.name:chq-jc-gateway}")
    private String prefix;



    public Properties getConfigServiceProperties() {
        Properties properties = new Properties();

        properties.put(SERVER_ADDR, Objects.toString(this.serverAddress, ""));
        properties.put(NAMESPACE, Objects.toString(this.namespace, ""));
        return properties;
    }


}
